import { BasicFetchResult } from '/@/api/model/baseMode';
import { defHttp } from '/@/utils/http/axios';

import { ErrorMessageMode } from '/@/utils/http/axios/types';

enum Api {
  // List = '/bannerManager/findPage',
  List = '/baseInfo/residenceApplicationManager/findPage',
  Delete = '/baseInfo/residenceApplicationManager/delete',
  Edit = '/baseInfo/residenceApplicationManager/edit',
}

/**
 * @description: 查询机构入驻申请列表
 */
export function ListApi(params, mode: ErrorMessageMode = 'modal') {
  return defHttp.get<BasicFetchResult<any>>(
    {
      url: Api.List,
      params,
    },
    {
      errorMessageMode: mode,
    }
  );
}

/**
 * @description: 更新申请
 */
export function UpdateApi(params, mode: ErrorMessageMode = 'modal') {
  return defHttp.put(
    {
      url: Api.Edit,
      params,
    },
    {
      errorMessageMode: mode,
    }
  );
}

/**
 * @description: 删除申请
 */
export function DeleteApi(userId: any, mode: ErrorMessageMode = 'modal') {
  return defHttp.delete(
    {
      url: Api.Delete + `/${userId}`,
    },
    {
      errorMessageMode: mode,
    }
  );
}
